home *** CD-ROM | disk | FTP | other *** search
/ Champak 125 / Vol 125 (Damaged).iso / games / rabbit_r.swf / scripts / __Packages / disney / rabbitRivalry / GameState.as < prev    next >
Encoding:
Text File  |  2009-06-09  |  1.8 KB  |  88 lines

  1. class disney.rabbitRivalry.GameState
  2. {
  3.    var score;
  4.    var misses;
  5.    var levelNum;
  6.    var actionState;
  7.    var GRAVITY;
  8.    var isYang;
  9.    var hasChanged;
  10.    static var __instance;
  11.    var __MISSES_ALLOWED = 5;
  12.    var TOTAL_LEVELS = 10;
  13.    function GameState()
  14.    {
  15.    }
  16.    static function init()
  17.    {
  18.       disney.rabbitRivalry.GameState.__instance = new disney.rabbitRivalry.GameState();
  19.    }
  20.    static function getInstance()
  21.    {
  22.       return disney.rabbitRivalry.GameState.__instance;
  23.    }
  24.    function reset()
  25.    {
  26.       this.score = 0;
  27.       this.misses = 0;
  28.       this.levelNum = 1;
  29.       this.actionState = 1;
  30.       this.GRAVITY = new smashing.Point3D(0,290,0);
  31.       if(Math.random() > 0.5)
  32.       {
  33.          this.isYang = true;
  34.       }
  35.       else
  36.       {
  37.          this.isYang = false;
  38.       }
  39.       this.hasChanged = false;
  40.    }
  41.    function addScore(num)
  42.    {
  43.       this.score += num;
  44.       smashing.keithm.Messenger.sendMessage("screen","updateScore");
  45.    }
  46.    function miss()
  47.    {
  48.       this.misses = this.misses + 1;
  49.    }
  50.    function removeMiss()
  51.    {
  52.       if(this.misses > 0)
  53.       {
  54.          this.misses = this.misses - 1;
  55.       }
  56.       else
  57.       {
  58.          this.addScore(250);
  59.       }
  60.    }
  61.    function isGameOver()
  62.    {
  63.       if(this.misses >= this.__MISSES_ALLOWED)
  64.       {
  65.          return true;
  66.       }
  67.       return false;
  68.    }
  69.    function advanceState()
  70.    {
  71.       this.actionState = this.actionState + 1;
  72.       if(this.actionState == 4)
  73.       {
  74.          smashing.keithm.Messenger.sendMessage("ui","disableActiveScreenUpdates");
  75.          smashing.keithm.Messenger.sendMessage("world","enablePowerAim");
  76.       }
  77.    }
  78.    function restartState()
  79.    {
  80.       this.actionState = 1;
  81.    }
  82.    function toggleRabbit()
  83.    {
  84.       this.restartState();
  85.       this.isYang = !this.isYang;
  86.    }
  87. }
  88.